
#ifndef ANDISPLAYSDK_DEFAULTSETTING_H
#define ANDISPLAYSDK_DEFAULTSETTING_H

#include "UsbDisplayReceiver.h"
#include <string.h>

static void defaultOnClientConnected(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientDisconnected(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientNameUpdated(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientTypeUpdated(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientShow(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientHide(DeviceClient *client, UsbDisplayDeviceHideType type) {
    (void) client;
    (void) type;
}

static bool defaultIsPermitToShow(DeviceClient *client) {
    (void) client;

    return true;
}

static void defaultOnClientResolutionChanged(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientLongPressed(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientRequestMouseAccelerate(DeviceClient *client, bool mouseAccelerate) {
    (void) client;
    (void) mouseAccelerate;
}

static void defaultOnClientSendMouseEvent(DeviceClient *client, int x, int y) {
    (void) client;
    (void) x;
    (void) y;
}

static void defaultOnClientSyncParameterEnd(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientRequestMirrorBackStart(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientRequestMirrorBackStop(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientRequestSendHomeKey(DeviceClient *client) {
    (void) client;
}

static void defaultOnClientRequestSendBackKey(DeviceClient *client) {
    (void) client;
}

static void defaultOnUsbDeviceAttached() {

}

static void defaultOnUsbDeviceDetached() {

}

static void defaultOnUsbDeviceReady() {

}

static void defaultOnRequestVersionInfoSuccess(const char *version) {
    (void) version;
}

static void defaultOnUpgradeUsbDeviceStarted() {

}

static void defaultOnUpgradeUsbDeviceInProgress(int progress) {
    (void) progress;
}

static void defaultOnUpgradeUsbDeviceSuccess() {

}

static void defaultOnUpgradeUsbDeviceFailed(UsbDisplayErrorCode errorCode) {
    (void) errorCode;
}

static void defaultOnConfigUsbDeviceSuccess() {

}

static void defaultOnConfigUsbDeviceFailed(UsbDisplayErrorCode errorCode) {
    (void) errorCode;
}

static void defaultUsbDisplayLog(UsbDisplayLogLevel level, const char *msg) {
    (void) level;
    (void) msg;
}

static void defaultOnVideoFrame(DeviceClient *client, char *buf, int length, int ts) {
    (void) client;
    (void) buf;
    (void) length;
    (void) ts;
}

static void defaultOnVideoInfo(const char* ip, VideoInfo videoInfo) {
    (void) ip;
    (void) videoInfo;
}

static void defaultOnAudioFrame(DeviceClient *client, char *buf, int length, int ts) {
    (void) client;
    (void) buf;
    (void) length;
    (void) ts;
}

static void defaultOnAudioInfoUpdated(DeviceClient *client, AudioInfo audioInfo) {
    (void) client;
    (void) audioInfo;
}

static void defaultOnClientSyncTransmitterId(const char* ip, const char* transmitterId) {
    (void) ip;
    (void) transmitterId;
}


static void defaultOnConnectPinCodeServerSuccess() {

}

static void defaultOnDisconnectFromPinCodeServer() {

}

static void defaultOnConnectPinCodeServerFailed(UsbDisplayErrorCode code) {
    (void) code;
}

static void defaultOnReceivedPinCode(const char* pinCode) {
    (void) pinCode;
}

static void defaultOnRequestStopAirplay(const char* ip) {
    (void) ip;
}

static void defaultOnActivateSuccess(const char* secret) {
    (void) secret;
}

static void defaultOnActivateFailed(UsbDisplayErrorCode errorCode, const char* reason) {
    (void) errorCode;
    (void) reason;
}

static void defaultOnClientUpdateAudioVolume(const char* ip, double volume) {
    (void) ip;
    (void) volume;
}

static void defaultOnClientRequestBYOMMode(const char* ip, const BYOMVideoInfo* videoInfo, const ByomAudioInfo* audioInfo) {
    (void) ip;
    (void) videoInfo;
    (void) audioInfo;
}

static void defaultOnClientRequestStopByom(const char* ip) {
    (void) ip;
}

static UsbDisplayCallback createDefaultCallback(void) {
    UsbDisplayCallback callback;
    memset(&callback, 0, sizeof(UsbDisplayCallback));
    callback.onClientConnected = defaultOnClientConnected;
    callback.onClientDisconnected = defaultOnClientDisconnected;
    callback.onDeviceNameUpdated = defaultOnClientNameUpdated;
    callback.onDeviceTypeUpdated = defaultOnClientTypeUpdated;
    callback.onDeviceShow = defaultOnClientShow;
    callback.onDeviceHide = defaultOnClientHide;
    callback.isPermitToShow = defaultIsPermitToShow;
    callback.onDeviceResolutionChanged = defaultOnClientResolutionChanged;
    callback.onLongPressed = defaultOnClientLongPressed;
    callback.onClientRequestMouseAccelerate = defaultOnClientRequestMouseAccelerate;
    callback.onClientSendMouseEvent = defaultOnClientSendMouseEvent;
    callback.onClientSyncParameterEnd = defaultOnClientSyncParameterEnd;
    callback.onClientRequestMirrorBackStart = defaultOnClientRequestMirrorBackStart;
    callback.onClientRequestMirrorBackStop = defaultOnClientRequestMirrorBackStop;
    callback.onClientRequestSendHomeKey = defaultOnClientRequestSendHomeKey;
    callback.onClientRequestSendBackKey = defaultOnClientRequestSendBackKey;

    callback.onUsbDeviceAttached = defaultOnUsbDeviceAttached;
    callback.onUsbDeviceDetached = defaultOnUsbDeviceDetached;
    callback.onUsbDeviceReady = defaultOnUsbDeviceReady;
    callback.onUpgradeUsbDeviceStarted = defaultOnUpgradeUsbDeviceStarted;
    callback.onUpgradeUsbDeviceInProgress = defaultOnUpgradeUsbDeviceInProgress;
    callback.onUpgradeUsbDeviceSuccess = defaultOnUpgradeUsbDeviceSuccess;
    callback.onUpgradeUsbDeviceFailed = defaultOnUpgradeUsbDeviceFailed;
    callback.onConfigUsbDeviceSuccess = defaultOnConfigUsbDeviceSuccess;
    callback.onConfigUsbDeviceFailed = defaultOnConfigUsbDeviceFailed;
    callback.onUsbDeviceRequestVersionInfoSuccess = defaultOnRequestVersionInfoSuccess;
    callback.onVideoFrame = defaultOnVideoFrame;
    callback.onVideoInfoUpdated = defaultOnVideoInfo;
    callback.onAudioFrame = defaultOnAudioFrame;
    callback.onAudioInfoUpdated = defaultOnAudioInfoUpdated;
    callback.onDeviceUpdateTransmitterId = defaultOnClientSyncTransmitterId;
    callback.onClientRequestUpdateAudioVolume = defaultOnClientUpdateAudioVolume;

    callback.onConnectPinCodeServerSuccess = defaultOnConnectPinCodeServerSuccess;
    callback.onDisconnectFromPinCodeServer = defaultOnDisconnectFromPinCodeServer;
    callback.onConnectPinCodeServerFailed = defaultOnConnectPinCodeServerFailed;
    callback.onReceivedPinCode = defaultOnReceivedPinCode;
    callback.onRequestStopAirplay = defaultOnRequestStopAirplay;

    callback.onActivateSuccess = defaultOnActivateSuccess;
    callback.onActivateFailed = defaultOnActivateFailed;

    callback.onClientRequestBYOMMode = defaultOnClientRequestBYOMMode;
    callback.onClientRequestStopByom = defaultOnClientRequestStopByom;

    callback.UsbDisplayLog = defaultUsbDisplayLog;
    return callback;
}

static UsbDisplaySupportFunctions createDefaultSupportFunctions() {
    UsbDisplaySupportFunctions functions;
    functions.snapShot = false;
    functions.bluetooth = false;
    functions.mouseAccelerate = false;
    functions.annotation = false;
    functions.audioTypeAac = false;
    functions.mirrorBack = false;
    functions.notSupportFullHeight = false;
    functions.androidAudio = true;//默认支持Android声音
    functions.notSupportAndroidDefaultRate = false;
    functions.supportVideoFormatH265 = false;
    functions.supportVideoVP8 = false;
    functions.supportVideoVP9 = false;
    functions.supportByomMode = false;

    return functions;
}


static UsbDisplayParameter createDefaultParameter() {
    UsbDisplayParameter parameter;

    strcpy(parameter.serverName, "UsbDisplay Demo");//在检查列表中显示的名字
    strcpy(parameter.serverVersion, "2.0.0");//在检索列表中显示出来的版本号信息
    strcpy(parameter.devicePassword, "");//设置投屏密码

    /**
     * setting for activate
     */
    strcpy(parameter.customerCode, "TRIAL_MEETING");
    strcpy(parameter.platformType, "TEST_MACHINE");
    strcpy(parameter.mac, "");
    strcpy(parameter.code, "");
    strcpy(parameter.secret, "");

    parameter.interface = USB_INTERFACE_WLAN;
    parameter.maxMirroringCount = 1;//最多一个设备在投屏
    parameter.racing = true; //当超过maxMirroringCount设备在投屏时，直接抢掉。
    parameter.supportMouseAccelerate = false;//不支持鼠标加速
    parameter.logLevel = USBDISPLAY_LOG_ERROR;
    parameter.receiverType = USBDISPLAY_RECEIVER_TYPE_NORMAL;
    parameter.targetFrameRate = 30;
    parameter.targetResolution = USBDISPLAY_RESOLUTION_1080P;
    parameter.targetVideoKeyFrameInterval = 0;
    parameter.targetVideoBitRate = 0;
    parameter.rotationDegree = USBDISPLAY_ROTATION_DEGREE_0;
    parameter.screenMirror = USBDISPLAY_SCREEN_MIRROR_DISABLED;
    parameter.discoverable = USBDISPLAY_TRUE;
    parameter.airplayDiscoverable = USBDISPLAY_TRUE;

    parameter.cbs = createDefaultCallback();
    parameter.functions = createDefaultSupportFunctions();
    return parameter;
}


#endif //ANDISPLAYSDK_DEFAULTSETTING_H
